export default function registerPolyline(lf) {
    // 连线属性
    lf.register('polyline', ({ PolylineEdge, PolylineEdgeModel }) => {
        class ConnnectionEdge extends PolylineEdge {

        }
        class ConnnectionModel extends PolylineEdgeModel {
            constructor(data, graphModel) {
                super(data, graphModel)

            }
            initEdgeData(data) {
                // console.log(data,'data333')
                let text = ''
                    // if('properties' in data){
                    //     text = data.properties.text
                    // }
                if ('text' in data) {
                    text = data.text.value
                }
                // data.type = 'sequenceFlow'
                data.text = {
                    value: text,
                    x: data.x,
                    y: data.y,
                }
                super.initEdgeData(data)
            }
            getEdgeStyle() {
                const style = super.getEdgeStyle()
                const { properties: { isExecuted, isDefault } } = this;
                // 走过的线条绿色
                if (isExecuted) {
                    style.stroke = "green"
                }
                // 默认流线条蓝色
                if (isDefault) {
                    style.stroke = "blue"
                }
                return style
            }

        }
        return {
            view: ConnnectionEdge,
            model: ConnnectionModel
        }
    })
}